//
//  BwtNativeExpressAdView.m
//  bwt_ad_flutter
//
//  Created by ciba on 2024/10/11.
//

#import "BwtNativeExpressAdView.h"

@implementation BwtNativeExpressAdView

//在这里只是创建了一个UILabel
-(instancetype)initWithWithFrame:(CGRect)frame viewIdentifier:(int64_t)viewId arguments:(id)args binaryMessenger:(NSObject<FlutterBinaryMessenger> *)messenger{
    if ([args isKindOfClass:[NSDictionary class]]) {
        NSDictionary *params = args;
        NSString *adId = params[@"adId"];
        if (adId) {
            BwtNativeExpressAdManager *bwtNativeExpressAdManager = [BwtNativeExpressAdManager getBwtNativeExpressAdManager];
            _nativeExpressAdView = [bwtNativeExpressAdManager getNativeExpressAdView:adId];
        }
    }
    return self;
}

- (nonnull UIView *)view {
    if (_nativeExpressAdView) {
        return _nativeExpressAdView;
    }
    return [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
}

@end
